# -*- coding:UTF-8 -*-


def anagrams(self, strs):
    dict={}
    for i in strs:
        sortedWord=''.join(sorted(i))
        print sortedWord
        dict[sortedWord]=[i] if sortedWord not in dict else dict[sortedWord]+[i]
    res =[]
    for item in dict:
        if len(dict[item])>=2:
            res+=dict[item]
    return res

print anagrams('',('ab', 'bc','aabc','ba','cd','dc'))

